package cn.bmbanjia.zebra2024.wwxy;

import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class WwxySendSms {

    private static final String url = "https://rcs.uninets.com.cn/uninetsOutInterface/domesticSmsSend";
    private static final String loginname = "H80172";
    private static final String password = "bmZQ08@!";
//    private static final JdkClientEngine engine = new JdkClientEngine();

//    public static void main(String[] args) {
//        sendMsg("17783738583", "您好，张队长，2023-08-25 11:00的搬家订单接单成功，请在一个小时内使用斑马接单中的客户隐私号联系客户确认订单信息。");
//    }

    public static void sendMsg(String phone, String content) {
//        JSONObject param = JSONUtil.ofObj();
//        param.put("loginname", loginname);
//        param.put("password", password);
//        param.put("phone", phone);
//        param.put("content", content);
//        String paramStr = param.toString();
//        Response response = engine.send(Request.of(url).body(paramStr).method(Method.POST));
//        System.out.println(response);

        String param = JSONUtil.createObj()
                .set("loginname", loginname)
                .set("password", password)
                .set("phone", phone)
                .set("content", content)
                .toString();

        log.info("WwxySendSms sendMsg req {}", param);
        String resp = HttpUtil.post(url, param);
        log.info("WwxySendSms sendMsg resp {}", resp);

    }

}
